﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;

namespace SqlCommandORM
{
   class Program
   {
      static void Main(string[] args)
      {
      }


   }

   public static class DataHelpers
   {
      public static List<T> ToList<T>(this IEnumerable<T> enumerable)
      {
         return new List<T>(enumerable);
      }

      public static IEnumerable<T> As<T>(this DbCommand command,Func<IDataRecord,T> map)
      {
         using(var reader=command.ExecuteReader())
            while(reader.Read())
               yield return map(reader);
      }
   }
}
